-
Notifications
You must be signed in to change notification settings - Fork 133
Conversation
currently it does only basic behavior and works only for module known to path resolver and loaded modules (variable module) no test yet. require many refactorings
src/Analysis/Core/Impl/DependencyResolution/PathResolverSnapshot.cs
Outdated
Show resolved
Hide resolved
… diagnostic cached for latest analysis
the reason it was assert was due to code like below that defines 2 functions with same signature and we only keep 1 symbol out of it. ... def f(x): class C: x = 12 def m(self): return x locals() return C self.assertEqual(f(1).x, 12) def f(x): class C: y = x def m(self): return x z = list(locals()) return C ...
added just one since it is very expensive.
…lready loaded by users code. for closed files that are never loaded in the editor before, it will use SymbolIndexer to find candidates. but since the indexer is syntax based, it wont be able to provide information that require semantic info such as imported members ex) from os import * or __all__.extend(core.__all__) which means we will not propose from os.path import join if os module is not already loaded, instead we will propose ntpath or mac/posixpath since that is where join is actually defined. unfortunately we can't load modules just for add import, it is too expensive. we might in future add another index that is based on analyzed data which could have correct info saved. but for now, this is what we decided.
made not to load modules. can you take another look? |
now we show them at the top if there is any.
src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs
Outdated
Show resolved
Hide resolved
src/Analysis/Core/Impl/DependencyResolution/PathResolverSnapshot.cs
Outdated
Show resolved
Hide resolved
@MikhailArkhipov any more feedback? |
@heejaechang Will it be possible to add an auto import feature? Importing with a quickfix is great, but it's the best when unresolved imports are auto imported on save. |
There are so many options for what a particular unresolved name could be that it might be impractical to do it right on save with no user input, or in cases where the unresolved name is just a local error (and not intended to be an import). We're going to start simple and go from there. (Also note that on-save may be more of a formatting operation, which we don't currently have plans to handle directly.) |
@heejaechang - I'd test it with Anaconda to be sure there are no performance issues and demo it to @Anapo14 to make sure behavior matches spec expectations. Otherwise LGTM. |
thank you! |
i see that 254c8f1 is not included in any releases, just master. does this mean it's not available in stable vs code? edit: sorry if this is the wrong place to ask this. i'm pretty confused by the various repos (microsoft/vscode-python, microsoft/python-language-server, etc) |
See #19 (comment) (where you also asked this). You can ignore the GitHub releases. |
Closes #19.
provides add import code action for unknown symbols.
...